package com.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @User xiangyl
 * @Data 2020/10/2
 */
public class JdkProxy implements InvocationHandler {

    private Object target=null;

    public JdkProxy(Object target){
        this.target=target;
    }


    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("before main function");
        Object invoke = method.invoke(target, args);
        System.out.println("after main function");
        return invoke;
    }
}
